//-----------------------------------------------------------------------
// <copyright file="DoiTacServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using APPro.Entities;
using APPro.Data;
    
namespace APPro.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class DoiTacServiceBase
    {
        #region DoiTacServiceBase

        public static void CreateDoiTac(DoiTac doiTac)
        {            
            try
            {
                DoiTacDAO doiTacDAO = new DoiTacDAO();
                doiTacDAO.CreateDoiTac(doiTac);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreateDoiTacException, ex);
            }
        }

        public static void UpdateDoiTac(DoiTac doiTac)
        {            
            try
            {
                DoiTacDAO doiTacDAO = new DoiTacDAO();
                doiTacDAO.UpdateDoiTac(doiTac);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdateDoiTacException, ex);
            }
        }        

        public static void DeleteDoiTac(int maDoiTac)
        {            
            try
            {
                DoiTacDAO doiTacDAO = new DoiTacDAO();
                doiTacDAO.DeleteDoiTac(maDoiTac);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeleteDoiTacException, ex);
            }
        }
		
        public static DoiTac GetDoiTac(int maDoiTac)
        {            
            try
            {
                DoiTacDAO doiTacDAO = new DoiTacDAO();
                return doiTacDAO.GetDoiTac(maDoiTac);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetDoiTacException, ex);
            }
        }                
		
        public static DoiTacCollection GetDoiTacList(DoiTacColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                DoiTacDAO doiTacDAO = new DoiTacDAO();
                return doiTacDAO.GetDoiTacList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetDoiTacListException, ex);
            }
        }        

        public static DoiTacCollection GetDoiTacList(DoiTacColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                DoiTacDAO doiTacDAO = new DoiTacDAO();
                return doiTacDAO.GetDoiTacList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetDoiTacListException, ex);
            }
        }        
		
		
        #endregion
    }
}